<?php
/**
 * Created by IntelliJ IDEA.
 * User: jimmyhsu
 * Date: 2017/4/3
 * Time: 21:58
 */
$course_id = $_GET['course_id'];
include ('facepp.php');
include ('../Teacher/checkLogin.php');
$facepp = new facepp();
$sql = "select faceset_token from course where course_id='$course_id'";
$query = mysqli_query($cn, $sql);
$resultArr = mysqli_fetch_array($query);
if (isset($resultArr['faceset_token'])) {
    $jsonArr = $facepp->remove_faceset_by_token($resultArr['faceset_token'], 0);
    if ($jsonArr['faceset_token'] == $resultArr['faceset_token']) {
        $sql = "update course set faceset_token='' where course_id='$course_id'";
        mysqli_query($cn, $sql);
        echo "success";
    } else {
        echo $jsonArr['error_message'];
    }
} else {
    echo $resultArr['error_message'];
}
echo "success";
